/**
 * Goods路由模块
 * routes/goods.js
 */
var express = require('express');
var router = express.Router();  
const goods = require("../controller/goods");
const auth = require("../controller/auth");

router.post('/add',auth.isLogin,auth.isSellerOrAdmi, goods.addGoods);

router.post("/addImg",goods.addImg)

router.get('/findbyid/:goods_id',auth.isLogin, goods.getGoodsById);

router.put('/update',auth.isLogin,auth.isSellerOrAdmi, goods.updateGoods);

router.get('/findbyname',auth.isLogin, goods.getGoodsByName);

router.get('/findbycategory',auth.isLogin, goods.getGoodsByCategory);

router.get('/findbyseller',auth.isLogin, goods.getGoodsBySeller);

router.get('/findbyprice',auth.isLogin, goods.getGoodsByPrice);

router.put('/browse/:goods_id',auth.isLogin, goods.browseGoods);

router.put('/setstatus',auth.isLogin,auth.isSellerOrAdmi, goods.setGoodsStatus);

router.delete('/delete/:goods_id',auth.isLogin,auth.isSellerOrAdmi, goods.removeGoods);

router.get("/findall",auth.isLogin,goods.getAll);

module.exports = router;